const express = require('express');
const router = express.Router();
const collectionController = require('../controllers/collectionController');
const userController = require('../controllers/userController');

// 所有路由都需要验证用户token
router.use(userController.verifyToken);

// 收藏题目
router.post('/add', collectionController.collectQuestion);

// 取消收藏
router.delete('/delete', collectionController.uncollectQuestion);

// 获取用户的收藏列表
router.get('/list', collectionController.getUserCollections);

// 检查题目是否已收藏
router.get('/check', collectionController.checkCollection);

// 获取题目的收藏数量
router.get('/count/:questionId', collectionController.getQuestionCollectionCount);

module.exports = router; 